package com.spring.springboot.sys.core.config;

import com.spring.springboot.sys.core.constant.ConstantsContext;
import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author admin
 * @date 2022-07-25 15:00:15:00
 * @description minio配置
 */
@Slf4j
@Configuration
public class MinioConfig {

    @Bean
    public MinioClient minioClient() {
        MinioProperties minioProperties = ConstantsContext.getMinioProperties();
        log.info("------------>:{}", "minioClient初始化成功！");
        return MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
    }

}
